﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vanfa.Entities.Album;
using Vanfa.Queries.Sql.DbModel;

namespace Vanfa.Biz.Album
{
    public static class EntConvertor
    {
        public static picUserPhoto ToDbEntity(this vUserPhoto vup)
        {
            var pup = new picUserPhoto
            {
                PhDesc = vup.PhDesc,
                PhName = vup.PhotoName,
                PhotoPath = vup.SourcePath,
                ThumbPath = vup.ThumbPath,
                UploadTime = DateTime.Now,
                ViewCount = 0,
                UserID = vup.UserID,
                PhotoID = vup.PhotoID
            };
            return pup;
        }

        public static vUserPhoto ToBizEntity(this picUserPhoto pup)
        {
            var up = new vUserPhoto
            {
                PhDesc = pup.PhDesc,
                PhotoID = pup.PhotoID,
                PhotoName = pup.PhName,
                SourcePath = pup.PhotoPath,
                ThumbPath = pup.ThumbPath,
                UploadTime = pup.UploadTime,
                UserID = pup.UserID,
                ViewCount = pup.ViewCount
            };
            return up;
        }
    }
}
